package org.linlinjava.litemall.db.dao;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.linlinjava.litemall.db.domain.FollowRelation;

import java.util.List;

@Mapper
public interface FollowRelationMapper {
    // 添加关注关系
    int insert(FollowRelation record);
    
    // 取消关注
    int deleteByFollowerAndFollowing(@Param("followerId") Long followerId, 
                                   @Param("followingId") Long followingId);
    
    // 查询是否已关注
    FollowRelation selectByFollowerAndFollowing(@Param("followerId") Long followerId,
                                              @Param("followingId") Long followingId);
    
    // 获取用户关注列表
    List<FollowRelation> selectFollowingsByFollowerId(Long followerId);
    
    // 获取用户粉丝列表
    List<FollowRelation> selectFollowersByFollowingId(Long followingId);
    
    // 获取关注数量
    int countFollowingsByFollowerId(Long followerId);
    
    // 获取粉丝数量
    int countFollowersByFollowingId(Long followingId);
} 